﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Actuals.CoreDomain;
using Actuals.CoreDomain.Business;

namespace Actuals.Business
{
    public class BusinessActualFiguresDashBoard : IBusinessActualFiguresDashBoard
    {
          private IBusinessActualFigures  _businessActualFigures;

        public BusinessActualFiguresDashBoard(IBusinessActualFigures businessActualFigures)
        {
            _businessActualFigures = businessActualFigures;
        }

        public BusinessActualFiguresDashBoard()
        {
            _businessActualFigures = new BusinessActualFigures();
        }

        public IActualFiguersDashBoard GetActualFiguresDashBoard(DateTime fromDate, DateTime toDate, int projectId, int releaseId)
        {
            IActualFiguersDashBoard actualFiguersDashBoard = new ActualFiguresDashBoard();
            IList<IActualFigures> _actualFiguresForFullTimers =
                _businessActualFigures.GetActualFiguresForFullTimers(fromDate, toDate, projectId, releaseId);

            IList<IActualFiguresPartTime> _actualFiguresForPartTimers =
                _businessActualFigures.GetActualFiguresForPartTimers(fromDate, toDate, projectId, releaseId);

            actualFiguersDashBoard.ActualFiguresForFullTimers = _actualFiguresForFullTimers;
            actualFiguersDashBoard.TotalHoursForFullTimers = _businessActualFigures.GetTotalHours(_actualFiguresForFullTimers);

            actualFiguersDashBoard.ActualFiguresForPartTimes = _actualFiguresForPartTimers;
            actualFiguersDashBoard.TotalHoursForPartTimers = _businessActualFigures.GetTotalHoursPartTime(_actualFiguresForPartTimers);

            actualFiguersDashBoard.TotalHours = actualFiguersDashBoard.TotalHoursForFullTimers +
                                                actualFiguersDashBoard.TotalHoursForPartTimers;


            return actualFiguersDashBoard;


        }
    }
}
